/**
 * 
 */
package com.tinchos.core;

/**
 * @author marting
 *
 */
public class NToWords {
	
	private static final String NUMERO_A_CONVERTIR = "34513604";

	/**
	 * @param args
	 */
	/*
	 *The program inputs a 7 digit number from the user.
	 *It brakes the input into chracters of array phoneArray.
	 *It then compares each digit and accordingly assigns the
	 *propper Letter-array for that number.
	 *It then prints all possible combinations.
	 */
	
	public static void main(String[] args) {
		
		char number2[] = { 'A', 'B', 'C' };
		char number3[] = { 'D', 'E', 'F' };
		char number4[] = { 'G', 'H', 'I' };
		char number5[] = { 'J', 'K', 'L' };
		char number6[] = { 'M', 'N', 'O' };
		char number7[] = { 'P', 'R', 'S' };
		char number8[] = { 'T', 'U', 'V' };
		char number9[] = { 'W', 'X', 'Y' };
		
		char Letter0[] = { ' ',' ',' ' };
		char Letter1[] = { ' ',' ',' ' };
		char Letter2[] = { ' ',' ',' ' };
		char Letter3[] = { ' ',' ',' ' };
		char Letter4[] = { ' ',' ',' ' };
		char Letter5[] = { ' ',' ',' ' };
		char Letter6[] = { ' ',' ',' ' };
		
		Character phoneArray[] = new Character[ 8 ];
		
		String phoneNumber = NUMERO_A_CONVERTIR;
		
//		Convert phoneNumber string to array of characters
		for( int i=0; i < phoneNumber.length(); i++ ) {
			phoneArray[i]=(new Character(phoneNumber.charAt(i)));
		}
		
//		for (int i=0;i < phoneArray.length; i++) {
//			if ( String.valueOf(phoneArray[i].charValue()).equals("0")) {
//				System.out.println("Invalid Input (0)");
//				System.exit(1);
//			}
//			else if (String.valueOf(phoneArray[i].charValue()).equals("1") ){
//				System.out.println("Invalid Input (1)");
//				System.exit(1);
//			}
//			
//		}
		
		
//		COMPARE FIRST DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = '1';
		else if (String.valueOf(phoneArray[0].charValue()).equals("2"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number2[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("3"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number3[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("4"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number4[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("5"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number5[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("6"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number6[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("7"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number7[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("8"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number8[j];
		else if (String.valueOf(phoneArray[0].charValue()).equals("9"))
			for (int j = 0; j < Letter0.length;j++)
				Letter0[j] = number9[j];
		
//		COMPARE SECOND DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = '1';
		else if (phoneArray[1].equals("2"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number2[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("3"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number3[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("4"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number4[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("5"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number5[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("6"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number6[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("7"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number7[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("8"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number8[j];
		else if (String.valueOf(phoneArray[1].charValue()).equals("9"))
			for (int j = 0; j < Letter1.length;j++)
				Letter1[j] = number9[j];
		
//		COMPARE THIRD DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = '1';
		else if (String.valueOf(phoneArray[2].charValue()).equals("2"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number2[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("3"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number3[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("4"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number4[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("5"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number5[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("6"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number6[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("7"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number7[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("8"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number8[j];
		else if (String.valueOf(phoneArray[2].charValue()).equals("9"))
			for (int j = 0; j < Letter2.length;j++)
				Letter2[j] = number9[j];
		
//		COMPARE FORTH DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = '1';
		else if (String.valueOf(phoneArray[3].charValue()).equals("2"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number2[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("3"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number3[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("4"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number4[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("5"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number5[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("6"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number6[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("7"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number7[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("8"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number8[j];
		else if (String.valueOf(phoneArray[3].charValue()).equals("9"))
			for (int j = 0; j < Letter3.length;j++)
				Letter3[j] = number9[j];
		
//		COMPARE FIFTH DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = '1';
		else if (String.valueOf(phoneArray[4].charValue()).equals("2"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number2[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("3"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number3[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("4"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number4[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("5"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number5[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("6"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number6[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("7"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number7[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("8"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number8[j];
		else if (String.valueOf(phoneArray[4].charValue()).equals("9"))
			for (int j = 0; j < Letter4.length;j++)
				Letter4[j] = number9[j];
		
//		COMPARE SIXTH DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = '1';
		else if (String.valueOf(phoneArray[5].charValue()).equals("2"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number2[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("3"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number3[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("4"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number4[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("5"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number5[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("6"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number6[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("7"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number7[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("8"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number8[j];
		else if (String.valueOf(phoneArray[5].charValue()).equals("9"))
			for (int j = 0; j < Letter5.length;j++)
				Letter5[j] = number9[j];
		
//		COMPARE SEVENTH DIGIT
		if (String.valueOf(phoneArray[0].charValue()).equals("0"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = '0';
		else if (String.valueOf(phoneArray[0].charValue()).equals("1"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = '1';
		else if (String.valueOf(phoneArray[6].charValue()).equals("2"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number2[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("3"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number3[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("4"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number4[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("5"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number5[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("6"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number6[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("7"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number7[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("8"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number8[j];
		else if (String.valueOf(phoneArray[6].charValue()).equals("9"))
			for (int j = 0; j < Letter6.length;j++)
				Letter6[j] = number9[j];
		
//		PRINT
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 3; k++) {
					for (int l = 0; l < 3; l++) {
						for (int m = 0; m < 3; m++) {
							for (int n = 0; n < 3; n++) {
								for (int o = 0; o<3; o++) {
									System.out.print(Letter0[i]);
									System.out.print(" ");
									System.out.print(Letter1[j]);
									System.out.print(" ");
									System.out.print(Letter2[k]);
									System.out.print(" ");
									System.out.print(Letter3[l]);
									System.out.print(" ");
									System.out.print(Letter4[m]);
									System.out.print(" ");
									System.out.print(Letter5[n]);
									System.out.print(" ");
									System.out.print(Letter6[o]);
									System.out.println();
								}
							}
						}
					}
				} //end k for
			} //end j for
		} // end i for
	}
}

